package com.youbug.mall.coupon_sms.controller;


import com.youbug.common.vo.QueryVo;
import com.youbug.mall.coupon_sms.entity.SmsSkuFullReduction;
import com.youbug.mall.coupon_sms.service.ISmsSkuFullReductionService;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.springframework.web.bind.annotation.*;
import com.youbug.common.vo.R;
import org.springframework.beans.factory.annotation.Autowired;

import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 * 商品满减信息 前端控制器
 * </p>
 *
 * @author youbug
 * @since 2024-04-24
 */
@RestController
@RequestMapping("/smsSkuFullReduction")
public class SmsSkuFullReductionController {
@Autowired
private ISmsSkuFullReductionService smsSkuFullReductionService;

    @PostMapping("/getSmsSkuFullReductionPage")
    public R<IPage<SmsSkuFullReduction>> getSmsSkuFullReductionPage(@RequestBody QueryVo<SmsSkuFullReduction> queryVo){

        IPage<SmsSkuFullReduction> smsSkuFullReductions = smsSkuFullReductionService.getSmsSkuFullReductionPage(queryVo);

        return R.ok(smsSkuFullReductions);
    }

    @GetMapping("/getSmsSkuFullReductionById/{id}")
    public R<SmsSkuFullReduction> getSmsSkuFullReductionById(@PathVariable Integer id){

        SmsSkuFullReduction smsSkuFullReduction = smsSkuFullReductionService.getById(id);

        return R.ok(smsSkuFullReduction);
    }

    @PostMapping("/add")
    public R<Boolean> add(@RequestBody SmsSkuFullReduction smsSkuFullReduction){

        boolean save = smsSkuFullReductionService.save(smsSkuFullReduction);

        return  R.ok(save);
    }

    @PostMapping("/update")
    public R<Boolean> update(@RequestBody SmsSkuFullReduction smsSkuFullReduction){

        boolean update = smsSkuFullReductionService.updateById(smsSkuFullReduction);

        return  R.ok(update);
    }

    @GetMapping("/delete/{id}")
    public R<Boolean> delete(@PathVariable Integer id){

        boolean remove = smsSkuFullReductionService.removeById(id);

        return  R.ok(remove);
    }
}

